Ext.apply(Ext.data.Store.prototype, {
	autoLoad: true
});

Ext.apply(Ext.form.BasicForm.prototype, {
	trackResetOnLoad: true
});

Ext.apply(Ext.form.Field.prototype, {
	labelSeparator: '',
	msgTarget: 'side'
});

Ext.apply(Ext.form.FormPanel.prototype, {
	labelAlign: 'right'
});

Ext.apply(Ext.grid.GridView.prototype, {
	forceFit: true
});

Ext.apply(Ext.Ajax, {
	disableCaching: false
});

Ext.apply(Ext.TabPanel.prototype, {
	plain: true
});

Ext.apply(Ext.Window.prototype, {
	autoScroll: true,
	bodyStyle: 'padding: 20px',
	defaults: { baseCls: 'x-plain' },
	constrain: true,
	modal: true,
	resizable: false,
	shadow: false
});

Ext.BLANK_IMAGE_URL = "ext-2.0-beta1/resources/images/default/s.gif";

function booleanRenderer(val) {
	return val ? "是" : "否";
}

function close() {
	Ext.WindowMgr.getActive().close();
}

function doAction(action, method, url, success) {
	Ext.WindowMgr.getActive().items.get(0).form.doAction(action, { method: method, success: success, url: url });
}

function load(url) {
	doAction('load', 'GET', url);
}

function reset() {
	Ext.WindowMgr.getActive().items.get(0).form.reset();
}

function submit(url, success) {
	doAction('submit', 'POST', url, success);
}

FREQUENCY  = '无线电频率指配审批';
SUSPENSION = '无线电台（站）停用、撤销备案';

SAVED     = '已保存';
SUBMITTED = '已提交';

function enterpriseRenderer(val) {
	return val.name;
}

function enumRenderer(val) {
	return eval(val.name);
}

Ext.onReady(function() {
	Ext.QuickTips.init();
	
	tab = new Ext.Viewport({
		items: [{
			html: '<image src="images/north.png" width="100%" height="95" />',
			baseCls: 'x-plain',
			region: 'north'
		}, {
			collapseMode: 'mini',
			collapsible: true,
			defaults: { border: false },
			items: [
				{ title: 'Accordion 1' },
				{ title: 'Accordion 2' },
				{ title: 'Accordion 3' },
				{ title: 'Accordion 4' },
				{ title: 'Accordion 5' }
			],
			layout: 'accordion',
			margins: '5 0 5 5',
			region: 'west',
			split: true,
			title: '功能导航',
			width: 200
		}, {
			frame: true,
			items: new Ext.TabPanel({ hidden: true }),
			layout: 'fit',
			margins: '5, 5, 5, 0',
			region: 'center',
			title: '数据窗口'
		}],
		layout: 'border'
	}).findByType('tabpanel')[0];
	
	tab.on('add', function(container, component, index) {
		this.setActiveTab(index);
		this.show();
	});
	
	applications();
//	login();
});
